package com.cooge.sharevideo.util;

import java.io.Serializable;
import java.util.List;

import com.cooge.sharevideo.base.B;

public class PageInfo<T> implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 4832933393975759499L;

	private int first;
	
	
	private Long pageSize;
	
	private int currentPage;
	
	private int totalPage;
	
	private int totalCount;
	
	private int max=10;
	
	private String asc;
	
	private String order;
	
	private T t;
	
	List<T> context;
	public PageInfo(){}
	public PageInfo(PageInfo<T> p,B<T> b){
		
		try {
			this.first = p.getFirst();
			this.max = p.getMax();
			this.asc = p.getAsc();
			this.order  = p.getOrder();
			this.t = p.getT();
			List<T>	list = b.getPageList(t, first,max,order,asc);
			this.setContext(list);
			this.setPageSize(b.getTotalSize(t));
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
	
	public int getFirst() {
		return first;
	}

	public void setFirst(int first) {
		this.first = first;
	}

	public int getMax() {
		return max;
	}

	public void setMax(int max) {
		this.max = max;
	}

	public List<T> getContext() {
		return context;
	}

	public void setContext(List<T> context) {
		this.context = context;
	}

	public Long getPageSize() {
		return pageSize;
	}

	public void setPageSize(Long pageSize) {
		this.pageSize = pageSize;
	}

	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	public int getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}

	public int getTotalCount() {
		return totalCount;
	}

	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
		
	}

	public String getAsc() {
		return asc;
	}

	public void setAsc(String asc) {
		this.asc = asc;
	}

	public String getOrder() {
		return order;
	}

	public void setOrder(String order) {
		this.order = order;
	}

	public T getT() {
		return t;
	}

	public void setT(T t) {
		this.t = t;
	}
	
	

}
